﻿using Smobiler.Core;
using Smobiler.Core.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;

namespace FubiManger.UI
{
    partial class EditTelForm : Smobiler.Core.Controls.MobileForm
    {
        public EditTelForm() : base()
        {
            //This call is required by the SmobilerForm.
            InitializeComponent();
        }
        /// <summary>
        /// 商户ID
        /// </summary>
        public string merchantid { get; set; }
        private void panclose_Press(object sender, EventArgs e)
        {
            this.Close();
        }
        /// <summary>
        /// 保存客服电话
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pansave_Press(object sender, EventArgs e)
        {
            try
            {
                if (txtphone.Text.Length == 11)
                {
                    if (merchantDal.Updatetel(txtphone.Text, merchantid) > 0)
                    {
                        Toast("保存成功");
                        this.Close();
                    }
                }               
                else
                {
                    MessageBox.Show("手机号长度不正确");
                }
            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.ToString());
            }
        }

        private void txtphone_TouchLeave(object sender, EventArgs e)
        {
            //try
            //{
            //  int num=  Convert.ToInt32(txtphone.Text);
            //}
            //catch (Exception)
            //{

            //    MessageBox.Show("手机号格式不正确");
            //}
        }

        private void EditTelForm_Load(object sender, EventArgs e)
        {
            txtphone.Text = merchantDal.Querytel(merchantid);//查商户热线
        }
    }
}